import 'package:json_annotation/json_annotation.dart';

import 'item_style.dart';
import 'line_style.dart';

part 'calendar.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class BaseLabel {
  var show;
  var margin;
  var position;
  var color;
  var fontStyle;
  var fontWeight;
  var fontFamily;
  var fontSize;
  var align;
  var lineHeight;
  var verticalAlign;
  var backgroundColor;
  var borderColor;
  var borderWidth;
  var borderType;
  var borderDashOffset;
  var borderRadius;
  var padding;

  var shadowColor;
  var shadowBlur;
  var shadowOffsetX;
  var shadowOffsetY;

  var width;
  var height;

  var textBorderColor;
  var textBorderWidth;
  var textBorderType;
  var textBorderDashOffset;
  var textShadowColor;
  var textShadowBlur;
  var textShadowOffsetX;
  var textShadowOffsetY;
  var overFlow;
  var ellipsis;
  var lineOverflow;

  var rich;

  BaseLabel(
      {this.show,
      this.margin,
      this.position,
      this.color,
      this.fontStyle,
      this.fontWeight,
      this.fontFamily,
      this.fontSize,
      this.align,
      this.lineHeight,
      this.verticalAlign,
      this.backgroundColor,
      this.borderColor,
      this.borderWidth,
      this.borderType,
      this.borderDashOffset,
      this.borderRadius,
      this.padding,
      this.shadowColor,
      this.shadowBlur,
      this.shadowOffsetX,
      this.shadowOffsetY,
      this.width,
      this.height,
      this.textBorderColor,
      this.textBorderWidth,
      this.textBorderType,
      this.textBorderDashOffset,
      this.textShadowColor,
      this.textShadowBlur,
      this.textShadowOffsetX,
      this.textShadowOffsetY,
      this.overFlow,
      this.ellipsis,
      this.lineOverflow,
      this.rich});

  factory BaseLabel.fromJson(Map<String, dynamic> json) =>
      _$BaseLabelFromJson(json);

  Map<String, dynamic> toJson() => _$BaseLabelToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class DayLabel extends BaseLabel {
  var firstDay;
  var nameMap;

  DayLabel({this.firstDay, this.nameMap});

  factory DayLabel.fromJson(Map<String, dynamic> json) =>
      _$DayLabelFromJson(json);

  Map<String, dynamic> toJson() => _$DayLabelToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class MonthLabel extends BaseLabel {
  var align;
  var nameMap;
  var formatter;

  MonthLabel({this.align, this.nameMap, this.formatter});

  factory MonthLabel.fromJson(Map<String, dynamic> json) =>
      _$MonthLabelFromJson(json);

  Map<String, dynamic> toJson() => _$MonthLabelToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class YearLabel extends BaseLabel {
  var formatter;

  YearLabel({this.formatter});

  factory YearLabel.fromJson(Map<String, dynamic> json) =>
      _$YearLabelFromJson(json);

  Map<String, dynamic> toJson() => _$YearLabelToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class CalendarSplitLine {
  var show;
  LineStyle? lineStyle;

  CalendarSplitLine({this.show, this.lineStyle});

  factory CalendarSplitLine.fromJson(Map<String, dynamic> json) =>
      _$CalendarSplitLineFromJson(json);

  Map<String, dynamic> toJson() => _$CalendarSplitLineToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class Calendar {
  var id;
  var zlvel;
  var z;

  var left;
  var top;
  var right;
  var bottom;
  var width;
  var height;
  var range;
  var cellSize;
  var orient;
  CalendarSplitLine? splitLine;
  ItemStyle? itemStyle;
  DayLabel? dayLabel;
  MonthLabel? monthLabel;
  YearLabel? yearLabel;
  var silent;

  Calendar(
      {this.id,
      this.zlvel,
      this.z,
      this.left,
      this.top,
      this.right,
      this.bottom,
      this.width,
      this.height,
      this.range,
      this.cellSize,
      this.orient,
      this.splitLine,
      this.itemStyle,
      this.dayLabel,
      this.monthLabel,
      this.yearLabel,
      this.silent});

  factory Calendar.fromJson(Map<String, dynamic> json) =>
      _$CalendarFromJson(json);

  Map<String, dynamic> toJson() => _$CalendarToJson(this);
}
